import request from '@/api/request'

export function getRecommendTasks(params) {
  return request({
    url: '/task/recommend',
    method: 'get',
    params
  })
}

export function getTaskList(params) {
  return request({
    url: '/task/list',
    method: 'get',
    params
  })
}

export function getTaskDetail(id) {
  return request({
    url: `/task/${id}`,
    method: 'get'
  })
}

export function acceptTask(id) {
  return request({
    url: `/task/${id}/accept`,
    method: 'post'
  })
}

export function getMyTasks(params) {
  return request({
    url: '/task/my-tasks',
    method: 'get',
    params
  })
}

export function submitTask(id, data) {
  return request({
    url: `/task/${id}/submit`,
    method: 'post',
    data
  })
}